Ext.ns('Taxamatch');

Taxamatch.ResultPanel = function(config){
	
	Ext.regModel('Result', {
            fields: [
                  'rank'
                , 'input'
                , 'match_type'
                , 'genus'
                , 'temp_authority'
                , 'genus_id'
                , 'species_ed'
                ]
        });

	
	this.store= new Ext.data.Store({
         model: 'Result'
			,	 sorters: 'match_type'
			/*,  getGroupString: function(record){
			         record.get('match_type')[0];
			     }*/
		});
	
	Ext.apply(this, config, { 
			draggable: false
		,	fullscreen: true
		,	id:'searchResultPanel'
		, layout:Ext.is.Phone? 'fit' :{
		         type:'vbox'
	         , align:'center'
	         , pack:'center'
		    } 
		,	items:[{
					xtype:'list'
				, fullscreen:true	
				,	store:this.store
				,	itemTpl: '<div><span>Rank: {rank}</span><br><span>Match Type: {match_type}</span><br><span>Genus: {genus}</span></div>'
				, width:'100%'
				, height:'100%'
				,	selModel: {
							mode: 'SINGLE'
						,	allowDeselect: true
						}
				//,	grouped: true
				,	indexBar: true
			}]
		,	dockedItems: [{
					xtype: 'toolbar'
				,	dock: 'top'
				,	title: '' 
				,	items: [{
						text: 'Search'
					,	ui: 'back'
					,	handler: function() {
							Ext.getCmp('mainPanel').setActiveItem(2);							
						}	
					}]
			}]
	});
	
	Taxamatch.ResultPanel.superclass.constructor.call(this,config);
};

Ext.extend(Taxamatch.ResultPanel , Ext.Panel, {
});